<html>
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %>
<%@include file="/quick/include/common.jsp"%>
<%@include file="/quick/include/globalScope.jsp"%>
  <head>
    <title><c:out value="${model.title}"/></title>
<style type="text/css">
<!--
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {color: #FF0000}
-->
</style>    
  </head>
  
  <table width="80%"  border="0" align="center" cellpadding="0" cellspacing="0" class="mainTable">
    <tr>
      <td background="<c:url value="/images/table_title.jpg"/>"><span class="style1">学生报名开关</span></td>
    </tr>
    <tr>
      <td>
        <div align="center">
        <c:choose>
          <c:when test="${model.EXTERNAL_EXAM_ENTRY_SWITCH=='Y' }">
	          <input type="button"  value="关闭报名" class="INPUT_button" onClick="f_set('1','N')">
	          <span class="style2">目前为开放状态！</span>          
          </c:when>
          <c:when test="${model.EXTERNAL_EXAM_ENTRY_SWITCH=='N' }">
	          <input type="button"  value="开放报名" class="INPUT_button" onClick="f_set('1','Y')">
	          <span class="style2">目前为关闭状态！</span>          
          </c:when>
        </c:choose>
       </div>
      </td>
    </tr>
  </table>
  

<table class="mainTable" align="center">
<tr>
<td>本次考试类型:</td>
<td>
<c:forEach var='examType' items="${model.types}">
  <c:choose>
    <c:when test="${examType.STATUS=='1' }">
       <input type="checkbox" name="typeBox" value="<c:out value="${examType.CODE}"/>" checked>
    </c:when>
    <c:otherwise>
       <input type="checkbox" name="typeBox" value="<c:out value="${examType.CODE}"/>">
    </c:otherwise>
  </c:choose>
   <c:out value="${examType.NAME}"/><br>
</c:forEach>
</td>
</tr>
<tr><td colspan='2' style="text-align:center"><input type="button" value="保存" class="input_button" onclick="f_set('2')"></td></tr>
</table>

  <table width="80%"  border="0" align="center" cellpadding="0" cellspacing="0" class="mainTable">
  <TR>
  	<TD nowrap>学年度:</TD>
  	<TD>
	<select name="schoolYear" disabled style="width:150px">
	  <c:forEach var='year' items="${model.years}">
	     <c:choose>
	       <c:when test="${year.CODE==model.currentYear}">
		      <option value="<c:out value="${year.CODE}"/>" selected><c:out value="${year.NAME}"/></option>
	       </c:when>
	       <c:otherwise>
		      <option value="<c:out value="${year.CODE}"/>"><c:out value="${year.NAME}"/></option>
	       </c:otherwise>
	     </c:choose>
	  </c:forEach>
	</select>
	</TD>
  </TR>
  <TR>
  	<TD nowrap>学期:</TD>
  	<TD>
	<select name="xq" disabled style="width:150px">
	   <option value=1  <c:if test="${model.currentSemester=='1'}"> selected</c:if> >第一学期</option>
       <option value=2  <c:if test="${model.currentSemester=='2'}"> selected</c:if> >第二学期</option>
	</select>
  	</TD>
  </TR>
  <TR>
  	<TD nowrap>考试类型:</TD>
  	<TD>
	<select name="examType" style="width:200px" onchange="f_set('3',this.value)">
		<option value="">请选择</option>
           <c:forEach var='examType' items="${model.types}">
		    <c:if test="${examType.STATUS=='1' }">
		       <option value="<c:out value="${examType.CODE}"/>"  <c:if test="${model.currentType==examType.CODE}"> selected</c:if>><c:out value="${examType.NAME}"/></option>
		    </c:if>
		   </c:forEach>
	</select>
  	</TD>
  </TR>
  <TR>
    <TD nowrap>报名状态:</TD>
    <TD>
    <input type="radio" name="entryStatus" value="1" <c:if test="${model.entryStatus=='1'}" > checked</c:if> onclick="_entryStatus('1')">
正在报名
	<input  type="radio" name="entryStatus" value="0" <c:if test="${model.entryStatus=='0'}" > checked</c:if> onclick="_entryStatus('0')">
报名已结束</TD>
  </TR>
  <tr>
    <td nowrap>冲突考试类型:</td>
    <td > &nbsp;
           <c:forEach var='examType' items="${model.types}">
		    <c:if test="${examType.STATUS=='1' and model.currentType!=null and examType.CODE!=model.currentType}">
		         <INPUT type=checkbox value="<c:out value="${examType.CODE }"/>" name="conflictType" <c:if test="${examType.CONFLICT_STATUS=='1'}">checked</c:if> ><c:out value="${examType.NAME }"/>
		    </c:if>
		   </c:forEach>
   </td>
  </tr>
  <tr>
  <td colspan="2" nowrap><input type="button" name="sz" value="设置" class="input_button" onclick="f_set('4')"></td>
  </tr>
  </table>
  
<script>
var currentType="<c:out value="${model.currentType}"/>";
var currentEntryStatus="<c:out value="${model.entryStatus}"/>";;
function  _entryStatus(status){
  currentEntryStatus=status;
}

function f_set(f,v){
  var url="<c:url value="/educational/examEntry/parameter.html"/>";
  switch(f){
    case '1'://报名开关
      var matrix=[["cmd","EXTERNAL_EXAM_ENTRY_SWITCH"],["EXTERNAL_EXAM_ENTRY_SWITCH",v]];
      break;
    case '2'://当前学年度学期有效报名类型
      var matrix=[["cmd","EXTERNAL_EXAM_ENTRY_TYPES"]];
      var boxes=Ext.query("input[name='typeBox']");
      Ext.each(boxes,function(box){
         if(box.checked) matrix.push(["entryType",box.value]);
      });
      break;
    case '3'://选择当前报名类型
      var matrix=[["cmd","EXTERNAL_EXAM_ENTRY_CURRENT_TYPE"],["EXTERNAL_EXAM_ENTRY_CURRENT_TYPE",v]];
      break;  
    case '4'://设置当前报名类型
      if(Ext.isEmpty(currentType)){
        alert("请选择校外考试报名类型");
        Ext.get('examType').dom.focus();
        return;
      }
      if(Ext.isEmpty(currentEntryStatus)){
        alert("请选择当前报名状态");
        return;
      }
      var i=Ext.get('examType').dom.selectedIndex;
      var currentTypeName=Ext.get('examType').dom.options[i].text;
      var matrix=[["cmd","EXTERNAL_EXAM_ENTRY_CURRENT_TYPE_PARAM"]];
      matrix.push(["EXTERNAL_EXAM_ENTRY_CURRENT_TYPE",currentType]);
      matrix.push(["currentTypeName",currentTypeName]);
      matrix.push(['currentEntryStatus',currentEntryStatus]);
      var boxes2=Ext.query("input[name='conflictType']");
      Ext.each(boxes2,function(box2){
         if(box2.checked) matrix.push(["conflictType",box2.value]);
      });
      
      break;  
  }
  var form=createForm(url,matrix);
  form.submit();

}
</script>
  
</html>   
